{
  "cells": [
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "# AutoML with FLAML Library\n",
        "\n",
        "\n",
        "|  | | | |\n",
        "|-----|--------|--------|--------|\n",
        "| <img src=\"https://www.microsoft.com/en-us/research/uploads/prod/2020/02/flaml-1024x406.png\" alt=\"drawing\" width=\"200\"/> \n",
        "\n",
        "\n",
        "<style>\n",
        "td, th {\n",
        "   border: none!important;\n",
        "}\n",
        "</style>\n",
        "### Goal\n",
        "In this notebook, we demonstrate how to use AutoML with FLAML to find the best model for our dataset.\n",
        "\n",
        "\n",
        "## 1. Introduction\n",
        "\n",
        "FLAML is a Python library (https://github.com/microsoft/FLAML) designed to automatically produce accurate machine learning models \n",
        "with low computational cost. It is fast and economical. The simple and lightweight design makes it easy to use and extend, such as adding new learners. FLAML can \n",
        "- serve as an economical AutoML engine,\n",
        "- be used as a fast hyperparameter tuning tool, or \n",
        "- be embedded in self-tuning software that requires low latency & resource in repetitive\n",
        "   tuning tasks.\n",
        "\n",
        "In this notebook, we use one real data example (binary classification) to showcase how to use FLAML library.\n",
        "\n",
        "FLAML requires `Python>=3.8`. To run this notebook example, please install the following packages."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "jupyter": {
          "outputs_hidden": true
        }
      },
      "outputs": [],
      "source": [
        "%pip install flaml[automl,synapse] xgboost==1.6.1 pandas==1.5.1 numpy==1.23.4 openml --force-reinstall"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "## 2. Classification Example\n",
        "### Load data and preprocess\n",
        "\n",
        "Download [Airlines dataset](https://www.openml.org/d/1169) from OpenML. The task is to predict whether a given flight will be delayed, given the information of the scheduled departure."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 41,
      "metadata": {
        "jupyter": {
          "outputs_hidden": true
        },
        "slideshow": {
          "slide_type": "subslide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:11:11.6973622Z",
              "execution_start_time": "2023-04-09T03:11:09.4074274Z",
              "livy_statement_state": "available",
              "parent_msg_id": "25ba0152-0936-464b-83eb-afa5f2f517fb",
              "queued_time": "2023-04-09T03:10:33.8002088Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 67
            },
            "text/plain": [
              "StatementMeta(automl, 7, 67, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/dask/dataframe/backends.py:187: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
            "  _numeric_index_types = (pd.Int64Index, pd.Float64Index, pd.UInt64Index)\n",
            "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/dask/dataframe/backends.py:187: FutureWarning: pandas.Float64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
            "  _numeric_index_types = (pd.Int64Index, pd.Float64Index, pd.UInt64Index)\n",
            "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/dask/dataframe/backends.py:187: FutureWarning: pandas.UInt64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
            "  _numeric_index_types = (pd.Int64Index, pd.Float64Index, pd.UInt64Index)\n"
          ]
        }
      ],
      "source": [
        "from flaml.automl.data import load_openml_dataset\n",
        "X_train, X_test, y_train, y_test = load_openml_dataset(dataset_id=1169, data_dir='./')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 42,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:11:12.2518637Z",
              "execution_start_time": "2023-04-09T03:11:11.9466307Z",
              "livy_statement_state": "available",
              "parent_msg_id": "c6f3064c-401e-447b-bd1d-65cd00f48fe1",
              "queued_time": "2023-04-09T03:10:33.901764Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 68
            },
            "text/plain": [
              "StatementMeta(automl, 7, 68, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Airline</th>\n",
              "      <th>Flight</th>\n",
              "      <th>AirportFrom</th>\n",
              "      <th>AirportTo</th>\n",
              "      <th>DayOfWeek</th>\n",
              "      <th>Time</th>\n",
              "      <th>Length</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>249392</th>\n",
              "      <td>EV</td>\n",
              "      <td>5309.0</td>\n",
              "      <td>MDT</td>\n",
              "      <td>ATL</td>\n",
              "      <td>3</td>\n",
              "      <td>794.0</td>\n",
              "      <td>131.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>166918</th>\n",
              "      <td>CO</td>\n",
              "      <td>1079.0</td>\n",
              "      <td>IAH</td>\n",
              "      <td>SAT</td>\n",
              "      <td>5</td>\n",
              "      <td>900.0</td>\n",
              "      <td>60.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>89110</th>\n",
              "      <td>US</td>\n",
              "      <td>1636.0</td>\n",
              "      <td>CLE</td>\n",
              "      <td>CLT</td>\n",
              "      <td>1</td>\n",
              "      <td>530.0</td>\n",
              "      <td>103.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>70258</th>\n",
              "      <td>WN</td>\n",
              "      <td>928.0</td>\n",
              "      <td>CMH</td>\n",
              "      <td>LAS</td>\n",
              "      <td>7</td>\n",
              "      <td>480.0</td>\n",
              "      <td>280.0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>492985</th>\n",
              "      <td>WN</td>\n",
              "      <td>729.0</td>\n",
              "      <td>GEG</td>\n",
              "      <td>LAS</td>\n",
              "      <td>3</td>\n",
              "      <td>630.0</td>\n",
              "      <td>140.0</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "       Airline  Flight AirportFrom AirportTo DayOfWeek   Time  Length\n",
              "249392      EV  5309.0         MDT       ATL         3  794.0   131.0\n",
              "166918      CO  1079.0         IAH       SAT         5  900.0    60.0\n",
              "89110       US  1636.0         CLE       CLT         1  530.0   103.0\n",
              "70258       WN   928.0         CMH       LAS         7  480.0   280.0\n",
              "492985      WN   729.0         GEG       LAS         3  630.0   140.0"
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "X_train.head()"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "### Run FLAML\n",
        "In the FLAML automl run configuration, users can specify the task type, time budget, error metric, learner list, whether to subsample, resampling strategy type, and so on. All these arguments have default values which will be used if users do not provide them. For example, the default classifiers are `['lgbm', 'xgboost', 'xgb_limitdepth', 'catboost', 'rf', 'extra_tree', 'lrl1']`. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 43,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:11:12.8001867Z",
              "execution_start_time": "2023-04-09T03:11:12.5256701Z",
              "livy_statement_state": "available",
              "parent_msg_id": "f2fba5ab-4e87-41e8-8a76-b7b7367e6fc6",
              "queued_time": "2023-04-09T03:10:34.0855462Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 69
            },
            "text/plain": [
              "StatementMeta(automl, 7, 69, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "''' import AutoML class from flaml package '''\n",
        "from flaml import AutoML\n",
        "automl = AutoML()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 44,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:11:13.391257Z",
              "execution_start_time": "2023-04-09T03:11:13.1109201Z",
              "livy_statement_state": "available",
              "parent_msg_id": "d5e4a7ed-3192-4e43-a7a8-44cf1469e685",
              "queued_time": "2023-04-09T03:10:34.3172166Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 70
            },
            "text/plain": [
              "StatementMeta(automl, 7, 70, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "settings = {\n",
        "    \"time_budget\": 120,  # total running time in seconds\n",
        "    \"metric\": 'accuracy', \n",
        "                        # check the documentation for options of metrics (https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML#optimization-metric)\n",
        "    \"task\": 'classification',  # task type\n",
        "    \"log_file_name\": 'airlines_experiment.log',  # flaml log file\n",
        "    \"seed\": 7654321,    # random seed\n",
        "}\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 45,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": [
          "outputPrepend"
        ]
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:20.8381216Z",
              "execution_start_time": "2023-04-09T03:11:13.647266Z",
              "livy_statement_state": "available",
              "parent_msg_id": "29dd0ba0-8f0d-428b-acb9-1d8e62f1b157",
              "queued_time": "2023-04-09T03:10:34.4667686Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 71
            },
            "text/plain": [
              "StatementMeta(automl, 7, 71, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[flaml.automl.automl: 04-09 03:11:13] {2726} INFO - task = classification\n",
            "[flaml.automl.automl: 04-09 03:11:13] {2728} INFO - Data split method: stratified\n",
            "[flaml.automl.automl: 04-09 03:11:13] {2731} INFO - Evaluation method: holdout\n",
            "[flaml.automl.automl: 04-09 03:11:14] {2858} INFO - Minimizing error metric: 1-accuracy\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3004} INFO - List of ML learners in AutoML Run: ['lgbm', 'rf', 'xgboost', 'extra_tree', 'xgb_limitdepth', 'lrl1']\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 0, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3472} INFO - Estimated sufficient time budget=17413s. Estimated necessary time budget=401s.\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 0.5s,\testimator lgbm's best error=0.3777,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 1, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 0.5s,\testimator lgbm's best error=0.3777,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 2, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 0.5s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 3, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 0.6s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 4, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 0.6s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 5, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.0s,\testimator xgboost's best error=0.3787,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 6, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.0s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 7, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.2s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 8, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.2s,\testimator rf's best error=0.3816,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 9, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.3s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 10, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3519} INFO -  at 1.3s,\testimator lgbm's best error=0.3614,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:14] {3334} INFO - iteration 11, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.5s,\testimator rf's best error=0.3791,\tbest estimator lgbm's best error=0.3614\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 12, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.6s,\testimator lgbm's best error=0.3550,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 13, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.7s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 14, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.8s,\testimator xgboost's best error=0.3746,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 15, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.9s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 16, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 1.9s,\testimator lgbm's best error=0.3550,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 17, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 2.2s,\testimator xgboost's best error=0.3699,\tbest estimator lgbm's best error=0.3550\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 18, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3519} INFO -  at 2.4s,\testimator lgbm's best error=0.3545,\tbest estimator lgbm's best error=0.3545\n",
            "[flaml.automl.automl: 04-09 03:11:15] {3334} INFO - iteration 19, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3519} INFO -  at 2.5s,\testimator lgbm's best error=0.3545,\tbest estimator lgbm's best error=0.3545\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3334} INFO - iteration 20, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3519} INFO -  at 2.9s,\testimator lgbm's best error=0.3545,\tbest estimator lgbm's best error=0.3545\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3334} INFO - iteration 21, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3519} INFO -  at 3.0s,\testimator lgbm's best error=0.3536,\tbest estimator lgbm's best error=0.3536\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3334} INFO - iteration 22, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3519} INFO -  at 3.1s,\testimator lgbm's best error=0.3536,\tbest estimator lgbm's best error=0.3536\n",
            "[flaml.automl.automl: 04-09 03:11:16] {3334} INFO - iteration 23, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3519} INFO -  at 3.4s,\testimator lgbm's best error=0.3536,\tbest estimator lgbm's best error=0.3536\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3334} INFO - iteration 24, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3519} INFO -  at 3.6s,\testimator rf's best error=0.3791,\tbest estimator lgbm's best error=0.3536\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3334} INFO - iteration 25, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3519} INFO -  at 3.9s,\testimator xgboost's best error=0.3596,\tbest estimator lgbm's best error=0.3536\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3334} INFO - iteration 26, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3519} INFO -  at 4.3s,\testimator lgbm's best error=0.3528,\tbest estimator lgbm's best error=0.3528\n",
            "[flaml.automl.automl: 04-09 03:11:17] {3334} INFO - iteration 27, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3519} INFO -  at 4.6s,\testimator xgboost's best error=0.3596,\tbest estimator lgbm's best error=0.3528\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3334} INFO - iteration 28, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3519} INFO -  at 4.7s,\testimator xgboost's best error=0.3596,\tbest estimator lgbm's best error=0.3528\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3334} INFO - iteration 29, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3519} INFO -  at 5.3s,\testimator xgboost's best error=0.3586,\tbest estimator lgbm's best error=0.3528\n",
            "[flaml.automl.automl: 04-09 03:11:18] {3334} INFO - iteration 30, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:20] {3519} INFO -  at 6.5s,\testimator lgbm's best error=0.3405,\tbest estimator lgbm's best error=0.3405\n",
            "[flaml.automl.automl: 04-09 03:11:20] {3334} INFO - iteration 31, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:20] {3519} INFO -  at 6.9s,\testimator lgbm's best error=0.3405,\tbest estimator lgbm's best error=0.3405\n",
            "[flaml.automl.automl: 04-09 03:11:20] {3334} INFO - iteration 32, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:21] {3519} INFO -  at 8.1s,\testimator lgbm's best error=0.3370,\tbest estimator lgbm's best error=0.3370\n",
            "[flaml.automl.automl: 04-09 03:11:21] {3334} INFO - iteration 33, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:11:21] {3519} INFO -  at 8.2s,\testimator rf's best error=0.3791,\tbest estimator lgbm's best error=0.3370\n",
            "[flaml.automl.automl: 04-09 03:11:21] {3334} INFO - iteration 34, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:23] {3519} INFO -  at 9.5s,\testimator lgbm's best error=0.3370,\tbest estimator lgbm's best error=0.3370\n",
            "[flaml.automl.automl: 04-09 03:11:23] {3334} INFO - iteration 35, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:24] {3519} INFO -  at 10.5s,\testimator lgbm's best error=0.3370,\tbest estimator lgbm's best error=0.3370\n",
            "[flaml.automl.automl: 04-09 03:11:24] {3334} INFO - iteration 36, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:11:24] {3519} INFO -  at 11.0s,\testimator xgboost's best error=0.3577,\tbest estimator lgbm's best error=0.3370\n",
            "[flaml.automl.automl: 04-09 03:11:24] {3334} INFO - iteration 37, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:25] {3519} INFO -  at 12.4s,\testimator lgbm's best error=0.3318,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:25] {3334} INFO - iteration 38, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3519} INFO -  at 12.6s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3334} INFO - iteration 39, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3519} INFO -  at 12.7s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3334} INFO - iteration 40, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3519} INFO -  at 13.1s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3334} INFO - iteration 41, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3519} INFO -  at 13.3s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3334} INFO - iteration 42, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3519} INFO -  at 13.4s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3318\n",
            "[flaml.automl.automl: 04-09 03:11:26] {3334} INFO - iteration 43, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3519} INFO -  at 14.8s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3334} INFO - iteration 44, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3519} INFO -  at 15.1s,\testimator xgb_limitdepth's best error=0.3630,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3334} INFO - iteration 45, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3519} INFO -  at 15.2s,\testimator xgb_limitdepth's best error=0.3623,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:28] {3334} INFO - iteration 46, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:30] {3519} INFO -  at 16.6s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:30] {3334} INFO - iteration 47, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:31] {3519} INFO -  at 18.0s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:31] {3334} INFO - iteration 48, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:33] {3519} INFO -  at 20.3s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:33] {3334} INFO - iteration 49, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:35] {3519} INFO -  at 22.2s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:35] {3334} INFO - iteration 50, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3519} INFO -  at 23.6s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3334} INFO - iteration 51, current learner lrl1\n",
            "No low-cost partial config given to the search algorithm. For cost-frugal search, consider providing low-cost values for cost-related hps via 'low_cost_partial_config'. More info can be found at https://microsoft.github.io/FLAML/docs/FAQ#about-low_cost_partial_config-in-tune\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3519} INFO -  at 23.8s,\testimator lrl1's best error=0.4339,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3334} INFO - iteration 52, current learner lrl1\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3519} INFO -  at 24.0s,\testimator lrl1's best error=0.4339,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3334} INFO - iteration 53, current learner lrl1\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3519} INFO -  at 24.2s,\testimator lrl1's best error=0.4339,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:37] {3334} INFO - iteration 54, current learner lrl1\n",
            "[flaml.automl.automl: 04-09 03:11:38] {3519} INFO -  at 25.0s,\testimator lrl1's best error=0.4334,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:38] {3334} INFO - iteration 55, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:39] {3519} INFO -  at 26.3s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:39] {3334} INFO - iteration 56, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:42] {3519} INFO -  at 28.7s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:42] {3334} INFO - iteration 57, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:11:42] {3519} INFO -  at 28.9s,\testimator rf's best error=0.3789,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:42] {3334} INFO - iteration 58, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:48] {3519} INFO -  at 35.0s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:48] {3334} INFO - iteration 59, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:11:49] {3519} INFO -  at 35.6s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:11:49] {3334} INFO - iteration 60, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:01] {3519} INFO -  at 47.9s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:01] {3334} INFO - iteration 61, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:01] {3519} INFO -  at 48.3s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:01] {3334} INFO - iteration 62, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:02] {3519} INFO -  at 49.1s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:02] {3334} INFO - iteration 63, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:04] {3519} INFO -  at 51.3s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:04] {3334} INFO - iteration 64, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:05] {3519} INFO -  at 52.0s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:05] {3334} INFO - iteration 65, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:06] {3519} INFO -  at 53.0s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:06] {3334} INFO - iteration 66, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:07] {3519} INFO -  at 54.2s,\testimator lgbm's best error=0.3282,\tbest estimator lgbm's best error=0.3282\n",
            "[flaml.automl.automl: 04-09 03:12:07] {3334} INFO - iteration 67, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:09] {3519} INFO -  at 55.9s,\testimator lgbm's best error=0.3274,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:09] {3334} INFO - iteration 68, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:10] {3519} INFO -  at 56.9s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:10] {3334} INFO - iteration 69, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:11] {3519} INFO -  at 58.3s,\testimator lgbm's best error=0.3274,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:11] {3334} INFO - iteration 70, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:12] {3519} INFO -  at 59.2s,\testimator lgbm's best error=0.3274,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:12] {3334} INFO - iteration 71, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:12] {3519} INFO -  at 59.4s,\testimator rf's best error=0.3781,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:12] {3334} INFO - iteration 72, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3519} INFO -  at 59.4s,\testimator rf's best error=0.3781,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3334} INFO - iteration 73, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3519} INFO -  at 59.5s,\testimator rf's best error=0.3725,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3334} INFO - iteration 74, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3519} INFO -  at 59.6s,\testimator rf's best error=0.3725,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3334} INFO - iteration 75, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3519} INFO -  at 59.7s,\testimator rf's best error=0.3725,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3334} INFO - iteration 76, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3519} INFO -  at 59.7s,\testimator rf's best error=0.3706,\tbest estimator lgbm's best error=0.3274\n",
            "[flaml.automl.automl: 04-09 03:12:13] {3334} INFO - iteration 77, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:18] {3519} INFO -  at 65.4s,\testimator lgbm's best error=0.3268,\tbest estimator lgbm's best error=0.3268\n",
            "[flaml.automl.automl: 04-09 03:12:18] {3334} INFO - iteration 78, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:21] {3519} INFO -  at 68.1s,\testimator lgbm's best error=0.3268,\tbest estimator lgbm's best error=0.3268\n",
            "[flaml.automl.automl: 04-09 03:12:21] {3334} INFO - iteration 79, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:21] {3519} INFO -  at 68.3s,\testimator rf's best error=0.3706,\tbest estimator lgbm's best error=0.3268\n",
            "[flaml.automl.automl: 04-09 03:12:21] {3334} INFO - iteration 80, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:27] {3519} INFO -  at 74.4s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:27] {3334} INFO - iteration 81, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:30] {3519} INFO -  at 77.0s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:30] {3334} INFO - iteration 82, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:12:30] {3519} INFO -  at 77.2s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:30] {3334} INFO - iteration 83, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3519} INFO -  at 96.7s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3334} INFO - iteration 84, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3519} INFO -  at 96.8s,\testimator rf's best error=0.3706,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3334} INFO - iteration 85, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3519} INFO -  at 97.0s,\testimator rf's best error=0.3678,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3334} INFO - iteration 86, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3519} INFO -  at 97.3s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:50] {3334} INFO - iteration 87, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 97.4s,\testimator rf's best error=0.3678,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 88, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 97.5s,\testimator rf's best error=0.3666,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 89, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 97.7s,\testimator rf's best error=0.3645,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 90, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 97.8s,\testimator rf's best error=0.3645,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 91, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 98.2s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 92, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 98.3s,\testimator rf's best error=0.3645,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 93, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3519} INFO -  at 98.3s,\testimator xgb_limitdepth's best error=0.3612,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:51] {3334} INFO - iteration 94, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:12:52] {3519} INFO -  at 98.5s,\testimator xgb_limitdepth's best error=0.3612,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:52] {3334} INFO - iteration 95, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:12:52] {3519} INFO -  at 98.8s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:52] {3334} INFO - iteration 96, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:12:58] {3519} INFO -  at 105.1s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:58] {3334} INFO - iteration 97, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:12:58] {3519} INFO -  at 105.3s,\testimator xgb_limitdepth's best error=0.3612,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:58] {3334} INFO - iteration 98, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3519} INFO -  at 105.5s,\testimator rf's best error=0.3560,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3334} INFO - iteration 99, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3519} INFO -  at 105.7s,\testimator rf's best error=0.3560,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3334} INFO - iteration 100, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3519} INFO -  at 106.0s,\testimator rf's best error=0.3560,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3334} INFO - iteration 101, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3519} INFO -  at 106.3s,\testimator rf's best error=0.3560,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3334} INFO - iteration 102, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3519} INFO -  at 106.4s,\testimator xgb_limitdepth's best error=0.3604,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:12:59] {3334} INFO - iteration 103, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:00] {3519} INFO -  at 106.7s,\testimator rf's best error=0.3547,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:00] {3334} INFO - iteration 104, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:06] {3519} INFO -  at 113.1s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:06] {3334} INFO - iteration 105, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:07] {3519} INFO -  at 113.5s,\testimator xgboost's best error=0.3561,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:07] {3334} INFO - iteration 106, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:09] {3519} INFO -  at 116.2s,\testimator lgbm's best error=0.3250,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:09] {3334} INFO - iteration 107, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 116.4s,\testimator xgb_limitdepth's best error=0.3604,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 108, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 116.5s,\testimator xgb_limitdepth's best error=0.3584,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 109, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 116.6s,\testimator xgb_limitdepth's best error=0.3584,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 110, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 116.8s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 111, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 116.9s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 112, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 117.1s,\testimator rf's best error=0.3547,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 113, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 117.2s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 114, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3519} INFO -  at 117.3s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:10] {3334} INFO - iteration 115, current learner lrl1\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3519} INFO -  at 118.0s,\testimator lrl1's best error=0.4334,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3334} INFO - iteration 116, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3519} INFO -  at 118.1s,\testimator rf's best error=0.3547,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3334} INFO - iteration 117, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3519} INFO -  at 118.3s,\testimator rf's best error=0.3547,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3334} INFO - iteration 118, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3519} INFO -  at 118.4s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:11] {3334} INFO - iteration 119, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3519} INFO -  at 118.5s,\testimator xgb_limitdepth's best error=0.3575,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3334} INFO - iteration 120, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3519} INFO -  at 118.6s,\testimator rf's best error=0.3547,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3334} INFO - iteration 121, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3519} INFO -  at 119.2s,\testimator xgb_limitdepth's best error=0.3520,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:12] {3334} INFO - iteration 122, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.8s,\testimator xgb_limitdepth's best error=0.3481,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 123, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.8s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 124, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.8s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 125, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.9s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 126, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.9s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 127, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.9s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 128, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 119.9s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3334} INFO - iteration 129, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:13:13] {3519} INFO -  at 120.0s,\testimator extra_tree's best error=0.3787,\tbest estimator lgbm's best error=0.3250\n",
            "[flaml.automl.automl: 04-09 03:13:19] {3783} INFO - retrain lgbm for 5.8s\n",
            "[flaml.automl.automl: 04-09 03:13:19] {3790} INFO - retrained model: LGBMClassifier(colsample_bytree=0.763983850698587,\n",
            "               learning_rate=0.087493667994037, max_bin=127,\n",
            "               min_child_samples=128, n_estimators=302, num_leaves=466,\n",
            "               reg_alpha=0.09968008477303378, reg_lambda=23.227419343318914,\n",
            "               verbose=-1)\n",
            "[flaml.automl.automl: 04-09 03:13:19] {3034} INFO - fit succeeded\n",
            "[flaml.automl.automl: 04-09 03:13:19] {3035} INFO - Time taken to find the best model: 74.35051536560059\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "/nfs4/pyenv-bfada21f-d1ed-44b9-a41d-4ff480d237e7/lib/python3.8/site-packages/sklearn/linear_model/_sag.py:350: ConvergenceWarning: The max_iter was reached which means the coef_ did not converge\n",
            "  warnings.warn(\n",
            "/nfs4/pyenv-bfada21f-d1ed-44b9-a41d-4ff480d237e7/lib/python3.8/site-packages/sklearn/linear_model/_sag.py:350: ConvergenceWarning: The max_iter was reached which means the coef_ did not converge\n",
            "  warnings.warn(\n",
            "/nfs4/pyenv-bfada21f-d1ed-44b9-a41d-4ff480d237e7/lib/python3.8/site-packages/sklearn/linear_model/_sag.py:350: ConvergenceWarning: The max_iter was reached which means the coef_ did not converge\n",
            "  warnings.warn(\n",
            "/nfs4/pyenv-bfada21f-d1ed-44b9-a41d-4ff480d237e7/lib/python3.8/site-packages/sklearn/linear_model/_sag.py:350: ConvergenceWarning: The max_iter was reached which means the coef_ did not converge\n",
            "  warnings.warn(\n",
            "/nfs4/pyenv-bfada21f-d1ed-44b9-a41d-4ff480d237e7/lib/python3.8/site-packages/sklearn/linear_model/_sag.py:350: ConvergenceWarning: The max_iter was reached which means the coef_ did not converge\n",
            "  warnings.warn(\n"
          ]
        }
      ],
      "source": [
        "'''The main flaml automl API'''\n",
        "automl.fit(X_train=X_train, y_train=y_train, **settings)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "### Best model and metric"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 46,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:21.4301236Z",
              "execution_start_time": "2023-04-09T03:13:21.0903825Z",
              "livy_statement_state": "available",
              "parent_msg_id": "7d9a796c-9ca5-415d-9dab-de06e4170216",
              "queued_time": "2023-04-09T03:10:34.5888418Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 72
            },
            "text/plain": [
              "StatementMeta(automl, 7, 72, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Best ML leaner: lgbm\n",
            "Best hyperparmeter config: {'n_estimators': 302, 'num_leaves': 466, 'min_child_samples': 128, 'learning_rate': 0.087493667994037, 'log_max_bin': 7, 'colsample_bytree': 0.763983850698587, 'reg_alpha': 0.09968008477303378, 'reg_lambda': 23.227419343318914}\n",
            "Best accuracy on validation data: 0.675\n",
            "Training duration of best run: 5.756 s\n"
          ]
        }
      ],
      "source": [
        "'''retrieve best config and best learner'''\n",
        "print('Best ML leaner:', automl.best_estimator)\n",
        "print('Best hyperparmeter config:', automl.best_config)\n",
        "print('Best accuracy on validation data: {0:.4g}'.format(1-automl.best_loss))\n",
        "print('Training duration of best run: {0:.4g} s'.format(automl.best_config_train_time))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 47,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:22.00515Z",
              "execution_start_time": "2023-04-09T03:13:21.668468Z",
              "livy_statement_state": "available",
              "parent_msg_id": "69be3bb6-08bb-40d8-bfbd-bfd3eabd2abf",
              "queued_time": "2023-04-09T03:10:34.6939373Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 73
            },
            "text/plain": [
              "StatementMeta(automl, 7, 73, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<style>#sk-container-id-1 {color: black;background-color: white;}#sk-container-id-1 pre{padding: 0;}#sk-container-id-1 div.sk-toggleable {background-color: white;}#sk-container-id-1 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-1 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-1 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-1 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-1 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-1 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-1 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-1 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-1 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-1 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-1 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-1 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-1 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-1 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-1 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-1 div.sk-item {position: relative;z-index: 1;}#sk-container-id-1 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-1 div.sk-item::before, #sk-container-id-1 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-1 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-1 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-1 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-1 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-1 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-1 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-1 div.sk-label-container {text-align: center;}#sk-container-id-1 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-1 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-1\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LGBMClassifier(colsample_bytree=0.763983850698587,\n",
              "               learning_rate=0.087493667994037, max_bin=127,\n",
              "               min_child_samples=128, n_estimators=302, num_leaves=466,\n",
              "               reg_alpha=0.09968008477303378, reg_lambda=23.227419343318914,\n",
              "               verbose=-1)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-1\" type=\"checkbox\" checked><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LGBMClassifier</label><div class=\"sk-toggleable__content\"><pre>LGBMClassifier(colsample_bytree=0.763983850698587,\n",
              "               learning_rate=0.087493667994037, max_bin=127,\n",
              "               min_child_samples=128, n_estimators=302, num_leaves=466,\n",
              "               reg_alpha=0.09968008477303378, reg_lambda=23.227419343318914,\n",
              "               verbose=-1)</pre></div></div></div></div></div>"
            ],
            "text/plain": [
              "LGBMClassifier(colsample_bytree=0.763983850698587,\n",
              "               learning_rate=0.087493667994037, max_bin=127,\n",
              "               min_child_samples=128, n_estimators=302, num_leaves=466,\n",
              "               reg_alpha=0.09968008477303378, reg_lambda=23.227419343318914,\n",
              "               verbose=-1)"
            ]
          },
          "execution_count": 19,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "automl.model.estimator"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 48,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:22.565239Z",
              "execution_start_time": "2023-04-09T03:13:22.2540989Z",
              "livy_statement_state": "available",
              "parent_msg_id": "75ef8b8e-a50b-4f56-9d25-5fc985379c27",
              "queued_time": "2023-04-09T03:10:34.7945603Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 74
            },
            "text/plain": [
              "StatementMeta(automl, 7, 74, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "'''pickle and save the automl object'''\n",
        "import pickle\n",
        "with open('automl.pkl', 'wb') as f:\n",
        "    pickle.dump(automl, f, pickle.HIGHEST_PROTOCOL)\n",
        "'''load pickled automl object'''\n",
        "with open('automl.pkl', 'rb') as f:\n",
        "    automl = pickle.load(f)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 49,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:25.1592289Z",
              "execution_start_time": "2023-04-09T03:13:22.8210504Z",
              "livy_statement_state": "available",
              "parent_msg_id": "32c71506-0598-4e00-aea9-cb84387ecc5b",
              "queued_time": "2023-04-09T03:10:34.9144997Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 75
            },
            "text/plain": [
              "StatementMeta(automl, 7, 75, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Predicted labels ['1' '0' '1' ... '1' '0' '0']\n",
            "True labels 118331    0\n",
            "328182    0\n",
            "335454    0\n",
            "520591    1\n",
            "344651    0\n",
            "         ..\n",
            "367080    0\n",
            "203510    1\n",
            "254894    0\n",
            "296512    1\n",
            "362444    0\n",
            "Name: Delay, Length: 134846, dtype: category\n",
            "Categories (2, object): ['0' < '1']\n"
          ]
        }
      ],
      "source": [
        "'''compute predictions of testing dataset''' \n",
        "y_pred = automl.predict(X_test)\n",
        "print('Predicted labels', y_pred)\n",
        "print('True labels', y_test)\n",
        "y_pred_proba = automl.predict_proba(X_test)[:,1]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 50,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:26.1850094Z",
              "execution_start_time": "2023-04-09T03:13:25.4270376Z",
              "livy_statement_state": "available",
              "parent_msg_id": "5c1b0a67-28a7-4155-84e2-e732fb48b37d",
              "queued_time": "2023-04-09T03:10:35.0461186Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 76
            },
            "text/plain": [
              "StatementMeta(automl, 7, 76, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "accuracy = 0.6732939797991784\n",
            "roc_auc = 0.7276250346550404\n",
            "log_loss = 0.6014655432027879\n"
          ]
        }
      ],
      "source": [
        "''' compute different metric values on testing dataset'''\n",
        "from flaml.ml import sklearn_metric_loss_score\n",
        "print('accuracy', '=', 1 - sklearn_metric_loss_score('accuracy', y_pred, y_test))\n",
        "print('roc_auc', '=', 1 - sklearn_metric_loss_score('roc_auc', y_pred_proba, y_test))\n",
        "print('log_loss', '=', sklearn_metric_loss_score('log_loss', y_pred_proba, y_test))"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "See Section 4 for an accuracy comparison with default LightGBM and XGBoost.\n",
        "\n",
        "### Log history"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 51,
      "metadata": {
        "slideshow": {
          "slide_type": "subslide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:26.7290827Z",
              "execution_start_time": "2023-04-09T03:13:26.4652129Z",
              "livy_statement_state": "available",
              "parent_msg_id": "74e2927e-2fe9-4956-9e67-1246b2b24c66",
              "queued_time": "2023-04-09T03:10:35.1554934Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 77
            },
            "text/plain": [
              "StatementMeta(automl, 7, 77, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{'Current Learner': 'lgbm', 'Current Sample': 10000, 'Current Hyper-parameters': {'n_estimators': 4, 'num_leaves': 4, 'min_child_samples': 20, 'learning_rate': 0.09999999999999995, 'log_max_bin': 8, 'colsample_bytree': 1.0, 'reg_alpha': 0.0009765625, 'reg_lambda': 1.0, 'FLAML_sample_size': 10000}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 4, 'num_leaves': 4, 'min_child_samples': 20, 'learning_rate': 0.09999999999999995, 'log_max_bin': 8, 'colsample_bytree': 1.0, 'reg_alpha': 0.0009765625, 'reg_lambda': 1.0, 'FLAML_sample_size': 10000}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 10000, 'Current Hyper-parameters': {'n_estimators': 26, 'num_leaves': 4, 'min_child_samples': 18, 'learning_rate': 0.2293009676418639, 'log_max_bin': 9, 'colsample_bytree': 0.9086551727646448, 'reg_alpha': 0.0015561782752413472, 'reg_lambda': 0.33127416269768944, 'FLAML_sample_size': 10000}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 26, 'num_leaves': 4, 'min_child_samples': 18, 'learning_rate': 0.2293009676418639, 'log_max_bin': 9, 'colsample_bytree': 0.9086551727646448, 'reg_alpha': 0.0015561782752413472, 'reg_lambda': 0.33127416269768944, 'FLAML_sample_size': 10000}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 40000, 'Current Hyper-parameters': {'n_estimators': 55, 'num_leaves': 4, 'min_child_samples': 20, 'learning_rate': 0.43653962213332903, 'log_max_bin': 10, 'colsample_bytree': 0.8048558760626646, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.23010605579846408, 'FLAML_sample_size': 40000}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 55, 'num_leaves': 4, 'min_child_samples': 20, 'learning_rate': 0.43653962213332903, 'log_max_bin': 10, 'colsample_bytree': 0.8048558760626646, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.23010605579846408, 'FLAML_sample_size': 40000}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 40000, 'Current Hyper-parameters': {'n_estimators': 90, 'num_leaves': 18, 'min_child_samples': 34, 'learning_rate': 0.3572626620529719, 'log_max_bin': 10, 'colsample_bytree': 0.9295656128173544, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.1981463604305675, 'FLAML_sample_size': 40000}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 90, 'num_leaves': 18, 'min_child_samples': 34, 'learning_rate': 0.3572626620529719, 'log_max_bin': 10, 'colsample_bytree': 0.9295656128173544, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.1981463604305675, 'FLAML_sample_size': 40000}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 40000, 'Current Hyper-parameters': {'n_estimators': 56, 'num_leaves': 7, 'min_child_samples': 92, 'learning_rate': 0.23536463281405412, 'log_max_bin': 10, 'colsample_bytree': 0.9898009552962395, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.143294261726433, 'FLAML_sample_size': 40000}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 56, 'num_leaves': 7, 'min_child_samples': 92, 'learning_rate': 0.23536463281405412, 'log_max_bin': 10, 'colsample_bytree': 0.9898009552962395, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.143294261726433, 'FLAML_sample_size': 40000}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 56, 'num_leaves': 7, 'min_child_samples': 92, 'learning_rate': 0.23536463281405412, 'log_max_bin': 10, 'colsample_bytree': 0.9898009552962395, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.143294261726433, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 56, 'num_leaves': 7, 'min_child_samples': 92, 'learning_rate': 0.23536463281405412, 'log_max_bin': 10, 'colsample_bytree': 0.9898009552962395, 'reg_alpha': 0.0009765625, 'reg_lambda': 0.143294261726433, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 179, 'num_leaves': 27, 'min_child_samples': 75, 'learning_rate': 0.09744966359309021, 'log_max_bin': 10, 'colsample_bytree': 1.0, 'reg_alpha': 0.002826104794043855, 'reg_lambda': 0.145731823715616, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 179, 'num_leaves': 27, 'min_child_samples': 75, 'learning_rate': 0.09744966359309021, 'log_max_bin': 10, 'colsample_bytree': 1.0, 'reg_alpha': 0.002826104794043855, 'reg_lambda': 0.145731823715616, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 180, 'num_leaves': 31, 'min_child_samples': 112, 'learning_rate': 0.14172261747380863, 'log_max_bin': 8, 'colsample_bytree': 0.9882716197099741, 'reg_alpha': 0.004676080321450302, 'reg_lambda': 2.7048628270368136, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 180, 'num_leaves': 31, 'min_child_samples': 112, 'learning_rate': 0.14172261747380863, 'log_max_bin': 8, 'colsample_bytree': 0.9882716197099741, 'reg_alpha': 0.004676080321450302, 'reg_lambda': 2.7048628270368136, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 284, 'num_leaves': 24, 'min_child_samples': 57, 'learning_rate': 0.34506374431782616, 'log_max_bin': 8, 'colsample_bytree': 0.9661606582789269, 'reg_alpha': 0.05708594148438563, 'reg_lambda': 3.080643548412343, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 284, 'num_leaves': 24, 'min_child_samples': 57, 'learning_rate': 0.34506374431782616, 'log_max_bin': 8, 'colsample_bytree': 0.9661606582789269, 'reg_alpha': 0.05708594148438563, 'reg_lambda': 3.080643548412343, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 150, 'num_leaves': 176, 'min_child_samples': 62, 'learning_rate': 0.2607939951456863, 'log_max_bin': 8, 'colsample_bytree': 1.0, 'reg_alpha': 0.015973158305354472, 'reg_lambda': 1.1581244082992237, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 150, 'num_leaves': 176, 'min_child_samples': 62, 'learning_rate': 0.2607939951456863, 'log_max_bin': 8, 'colsample_bytree': 1.0, 'reg_alpha': 0.015973158305354472, 'reg_lambda': 1.1581244082992237, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 100, 'num_leaves': 380, 'min_child_samples': 83, 'learning_rate': 0.1439688182217924, 'log_max_bin': 7, 'colsample_bytree': 0.9365250834556608, 'reg_alpha': 0.07492795084698504, 'reg_lambda': 10.854898771631566, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 100, 'num_leaves': 380, 'min_child_samples': 83, 'learning_rate': 0.1439688182217924, 'log_max_bin': 7, 'colsample_bytree': 0.9365250834556608, 'reg_alpha': 0.07492795084698504, 'reg_lambda': 10.854898771631566, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 157, 'num_leaves': 985, 'min_child_samples': 115, 'learning_rate': 0.15986853540486204, 'log_max_bin': 6, 'colsample_bytree': 0.8905312088154893, 'reg_alpha': 0.17376372850615002, 'reg_lambda': 196.8899439847594, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 157, 'num_leaves': 985, 'min_child_samples': 115, 'learning_rate': 0.15986853540486204, 'log_max_bin': 6, 'colsample_bytree': 0.8905312088154893, 'reg_alpha': 0.17376372850615002, 'reg_lambda': 196.8899439847594, 'FLAML_sample_size': 364083}}\n",
            "{'Current Learner': 'lgbm', 'Current Sample': 364083, 'Current Hyper-parameters': {'n_estimators': 302, 'num_leaves': 466, 'min_child_samples': 128, 'learning_rate': 0.087493667994037, 'log_max_bin': 7, 'colsample_bytree': 0.763983850698587, 'reg_alpha': 0.09968008477303378, 'reg_lambda': 23.227419343318914, 'FLAML_sample_size': 364083}, 'Best Learner': 'lgbm', 'Best Hyper-parameters': {'n_estimators': 302, 'num_leaves': 466, 'min_child_samples': 128, 'learning_rate': 0.087493667994037, 'log_max_bin': 7, 'colsample_bytree': 0.763983850698587, 'reg_alpha': 0.09968008477303378, 'reg_lambda': 23.227419343318914, 'FLAML_sample_size': 364083}}\n"
          ]
        }
      ],
      "source": [
        "from flaml.automl.data import get_output_from_log\n",
        "time_history, best_valid_loss_history, valid_loss_history, config_history, metric_history = \\\n",
        "    get_output_from_log(filename=settings['log_file_name'], time_budget=240)\n",
        "for config in config_history:\n",
        "    print(config)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 52,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:27.2414306Z",
              "execution_start_time": "2023-04-09T03:13:26.9671462Z",
              "livy_statement_state": "available",
              "parent_msg_id": "5e00da90-af15-4ffd-b1b5-b946fabfc565",
              "queued_time": "2023-04-09T03:10:35.2740852Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 78
            },
            "text/plain": [
              "StatementMeta(automl, 7, 78, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAHHCAYAAABXx+fLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABNL0lEQVR4nO3de1xUdf4/8NcwMAMqDCoMjMhNCRMRL6jEkrdEUcvS/Bm1uoi2WoiKYrvKtolWC7qtl9xcUUvUrPWCWpiKKV7KvOYtCQXvmHLRkIsXGJ05vz/8MtvEgAzOMDDn9Xw85vFwPudzzrw/Qw949Tmfc45EEAQBRERERCJiY+kCiIiIiBoaAxARERGJDgMQERERiQ4DEBEREYkOAxARERGJDgMQERERiQ4DEBEREYkOAxARERGJDgMQERERiQ4DEBE1ST4+PoiOjrZ0GUTURDEAEYnY6tWrIZFI8OOPP1q6lCanoqICixYtQkhICBQKBezt7eHv74/JkycjNzfX0uUR0RPYWroAIqL6yMnJgY2NZf4f7vbt2xg8eDBOnDiBl156CX/84x/RokUL5OTkYP369VixYgXUarVFaiOiumEAIiKLe/ToEbRaLWQyWZ33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knBvfp1q0bXFxc8MMPP+Cll14C8PhGjxqNBiEhIWjWrBnWrVsHBwcHeHt76/b7/vvvMWjQoAYZF1FjxhkgIhHq378/Hjx4AD8/P916FOBxgCgvL9ddLg8Arq6uWL16NTZt2oSAgADMmzcP//rXv566hkmTJuHbb7/FjRs3MGLECDz77LP485//DCcnJ7zzzjsG9xk+fDg+/vhj/Otf/0KnTp2wfPlypKam6s1ibd68GT179sQbb7yBgIAA/PWvf4VGo6l2LFtbW/z3v/9Fp06d8MILLzz1rNbTCAoKwoEDB5Cbm4vevXujW7dumD17Ntq0aVPjPlKpFOPGjcMXX3yha3N2dsbKlSsRFhaGoKAg7NmzB9u2bUPr1q0BADdu3MChQ4cwbtw4s4+JqLGTCML/XYdJRERNSkFBATp16oSTJ0/qzfLUZObMmbhz5w5WrFjRANURNW6cASIiaqLc3d3x2Wef1flqPKVSabHHdhA1NpwBIiIiItHhDBARERGJDgMQERERiQ4DEBEREYkOAxARERGJDgMQERERiQ4DEBEREYkOAxARERGJDgMQERERiQ4DEBEREYnO/wcZWnMBFsR3JwAAAABJRU5ErkJggg==",
            "text/plain": [
              "<Figure size 640x480 with 1 Axes>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "import matplotlib.pyplot as plt\n",
        "import numpy as np\n",
        "\n",
        "plt.title('Learning Curve')\n",
        "plt.xlabel('Wall Clock Time (s)')\n",
        "plt.ylabel('Validation Accuracy')\n",
        "plt.scatter(time_history, 1 - np.array(valid_loss_history))\n",
        "plt.step(time_history, 1 - np.array(best_valid_loss_history), where='post')\n",
        "plt.show()"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## 3. Comparison with alternatives\n"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Default LightGBM"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 53,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:27.7753221Z",
              "execution_start_time": "2023-04-09T03:13:27.4870777Z",
              "livy_statement_state": "available",
              "parent_msg_id": "249fba84-ec7c-4801-9dac-861ffa0d0290",
              "queued_time": "2023-04-09T03:10:35.4112806Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 79
            },
            "text/plain": [
              "StatementMeta(automl, 7, 79, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "from lightgbm import LGBMClassifier\n",
        "lgbm = LGBMClassifier()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 54,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:29.4430851Z",
              "execution_start_time": "2023-04-09T03:13:28.0142422Z",
              "livy_statement_state": "available",
              "parent_msg_id": "635ca27a-7ae7-44e9-9d57-f81b36236398",
              "queued_time": "2023-04-09T03:10:35.511851Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 80
            },
            "text/plain": [
              "StatementMeta(automl, 7, 80, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<style>#sk-container-id-2 {color: black;background-color: white;}#sk-container-id-2 pre{padding: 0;}#sk-container-id-2 div.sk-toggleable {background-color: white;}#sk-container-id-2 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-2 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-2 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-2 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-2 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-2 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-2 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-2 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-2 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-2 div.sk-item {position: relative;z-index: 1;}#sk-container-id-2 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-2 div.sk-item::before, #sk-container-id-2 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-2 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-2 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-2 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-2 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-2 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-2 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-2 div.sk-label-container {text-align: center;}#sk-container-id-2 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-2 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>LGBMClassifier()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-2\" type=\"checkbox\" checked><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">LGBMClassifier</label><div class=\"sk-toggleable__content\"><pre>LGBMClassifier()</pre></div></div></div></div></div>"
            ],
            "text/plain": [
              "LGBMClassifier()"
            ]
          },
          "execution_count": 33,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "lgbm.fit(X_train, y_train)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 55,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:30.0093622Z",
              "execution_start_time": "2023-04-09T03:13:29.7202855Z",
              "livy_statement_state": "available",
              "parent_msg_id": "608a77ce-d7b2-4921-adff-d1618a8316ad",
              "queued_time": "2023-04-09T03:10:35.6550041Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 81
            },
            "text/plain": [
              "StatementMeta(automl, 7, 81, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "y_pred_lgbm = lgbm.predict(X_test)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Default XGBoost"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 56,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:30.5721373Z",
              "execution_start_time": "2023-04-09T03:13:30.2846919Z",
              "livy_statement_state": "available",
              "parent_msg_id": "4b08eacb-4745-48d9-b223-ec5fbdab69ab",
              "queued_time": "2023-04-09T03:10:35.7535047Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 82
            },
            "text/plain": [
              "StatementMeta(automl, 7, 82, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "from xgboost import XGBClassifier\n",
        "xgb = XGBClassifier()\n",
        "cat_columns = X_train.select_dtypes(include=['category']).columns\n",
        "X = X_train.copy()\n",
        "X[cat_columns] = X[cat_columns].apply(lambda x: x.cat.codes)\n",
        "y_train_xgb = y_train.astype(\"int\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 57,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:38.5603565Z",
              "execution_start_time": "2023-04-09T03:13:30.8138989Z",
              "livy_statement_state": "available",
              "parent_msg_id": "7536603f-0254-4f00-aac1-73d67d529a05",
              "queued_time": "2023-04-09T03:10:35.8542308Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 83
            },
            "text/plain": [
              "StatementMeta(automl, 7, 83, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<style>#sk-container-id-3 {color: black;background-color: white;}#sk-container-id-3 pre{padding: 0;}#sk-container-id-3 div.sk-toggleable {background-color: white;}#sk-container-id-3 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-3 label.sk-toggleable__label-arrow:before {content: \"▸\";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-3 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-3 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-3 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-3 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-3 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-3 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: \"▾\";}#sk-container-id-3 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-3 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-3 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-3 div.sk-parallel-item::after {content: \"\";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-3 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-3 div.sk-serial::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-3 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-3 div.sk-item {position: relative;z-index: 1;}#sk-container-id-3 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-3 div.sk-item::before, #sk-container-id-3 div.sk-parallel-item::before {content: \"\";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-3 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-3 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-3 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-3 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-3 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-3 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-3 div.sk-label-container {text-align: center;}#sk-container-id-3 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-3 div.sk-text-repr-fallback {display: none;}</style><div id=\"sk-container-id-3\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>XGBClassifier(base_score=0.5, booster=&#x27;gbtree&#x27;, callbacks=None,\n",
              "              colsample_bylevel=1, colsample_bynode=1, colsample_bytree=1,\n",
              "              early_stopping_rounds=None, enable_categorical=False,\n",
              "              eval_metric=None, gamma=0, gpu_id=-1, grow_policy=&#x27;depthwise&#x27;,\n",
              "              importance_type=None, interaction_constraints=&#x27;&#x27;,\n",
              "              learning_rate=0.300000012, max_bin=256, max_cat_to_onehot=4,\n",
              "              max_delta_step=0, max_depth=6, max_leaves=0, min_child_weight=1,\n",
              "              missing=nan, monotone_constraints=&#x27;()&#x27;, n_estimators=100,\n",
              "              n_jobs=0, num_parallel_tree=1, predictor=&#x27;auto&#x27;, random_state=0,\n",
              "              reg_alpha=0, reg_lambda=1, ...)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-3\" type=\"checkbox\" checked><label for=\"sk-estimator-id-3\" class=\"sk-toggleable__label sk-toggleable__label-arrow\">XGBClassifier</label><div class=\"sk-toggleable__content\"><pre>XGBClassifier(base_score=0.5, booster=&#x27;gbtree&#x27;, callbacks=None,\n",
              "              colsample_bylevel=1, colsample_bynode=1, colsample_bytree=1,\n",
              "              early_stopping_rounds=None, enable_categorical=False,\n",
              "              eval_metric=None, gamma=0, gpu_id=-1, grow_policy=&#x27;depthwise&#x27;,\n",
              "              importance_type=None, interaction_constraints=&#x27;&#x27;,\n",
              "              learning_rate=0.300000012, max_bin=256, max_cat_to_onehot=4,\n",
              "              max_delta_step=0, max_depth=6, max_leaves=0, min_child_weight=1,\n",
              "              missing=nan, monotone_constraints=&#x27;()&#x27;, n_estimators=100,\n",
              "              n_jobs=0, num_parallel_tree=1, predictor=&#x27;auto&#x27;, random_state=0,\n",
              "              reg_alpha=0, reg_lambda=1, ...)</pre></div></div></div></div></div>"
            ],
            "text/plain": [
              "XGBClassifier(base_score=0.5, booster='gbtree', callbacks=None,\n",
              "              colsample_bylevel=1, colsample_bynode=1, colsample_bytree=1,\n",
              "              early_stopping_rounds=None, enable_categorical=False,\n",
              "              eval_metric=None, gamma=0, gpu_id=-1, grow_policy='depthwise',\n",
              "              importance_type=None, interaction_constraints='',\n",
              "              learning_rate=0.300000012, max_bin=256, max_cat_to_onehot=4,\n",
              "              max_delta_step=0, max_depth=6, max_leaves=0, min_child_weight=1,\n",
              "              missing=nan, monotone_constraints='()', n_estimators=100,\n",
              "              n_jobs=0, num_parallel_tree=1, predictor='auto', random_state=0,\n",
              "              reg_alpha=0, reg_lambda=1, ...)"
            ]
          },
          "execution_count": 39,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "xgb.fit(X, y_train_xgb)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 58,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:39.158293Z",
              "execution_start_time": "2023-04-09T03:13:38.8646861Z",
              "livy_statement_state": "available",
              "parent_msg_id": "6cc9c9ae-70a1-4233-8d7e-87b0f49cfe84",
              "queued_time": "2023-04-09T03:10:35.9526459Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 84
            },
            "text/plain": [
              "StatementMeta(automl, 7, 84, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "X = X_test.copy()\n",
        "X[cat_columns] = X[cat_columns].apply(lambda x: x.cat.codes)\n",
        "y_pred_xgb = xgb.predict(X)\n",
        "y_test_xgb = y_test.astype(\"int\")\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 59,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:40.1931477Z",
              "execution_start_time": "2023-04-09T03:13:39.4172862Z",
              "livy_statement_state": "available",
              "parent_msg_id": "ce07a96a-a8a2-43f1-b7fc-c76eb204382e",
              "queued_time": "2023-04-09T03:10:36.0501561Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 85
            },
            "text/plain": [
              "StatementMeta(automl, 7, 85, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "default xgboost accuracy = 0.6676060098186078\n",
            "default lgbm accuracy = 0.6602346380315323\n",
            "flaml (10 min) accuracy = 0.6732939797991784\n"
          ]
        }
      ],
      "source": [
        "print('default xgboost accuracy', '=', 1 - sklearn_metric_loss_score('accuracy', y_pred_xgb, y_test_xgb))\n",
        "print('default lgbm accuracy', '=', 1 - sklearn_metric_loss_score('accuracy', y_pred_lgbm, y_test))\n",
        "print('flaml (2 min) accuracy', '=', 1 - sklearn_metric_loss_score('accuracy', y_pred, y_test))"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "## 4. Customized Learner"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "Some experienced automl users may have a preferred model to tune or may already have a reasonably by-hand-tuned model before launching the automl experiment. They need to select optimal configurations for the customized model mixed with standard built-in learners. \n",
        "\n",
        "FLAML can easily incorporate customized/new learners (preferably with sklearn API) provided by users in a real-time manner, as demonstrated below."
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "### Example of Regularized Greedy Forest\n",
        "\n",
        "[Regularized Greedy Forest](https://arxiv.org/abs/1109.0887) (RGF) is a machine learning method currently not included in FLAML. The RGF has many tuning parameters, the most critical of which are: `[max_leaf, n_iter, n_tree_search, opt_interval, min_samples_leaf]`. To run a customized/new learner, the user needs to provide the following information:\n",
        "* an implementation of the customized/new learner\n",
        "* a list of hyperparameter names and types\n",
        "* rough ranges of hyperparameters (i.e., upper/lower bounds)\n",
        "* choose initial value corresponding to low cost for cost-related hyperparameters (e.g., initial value for max_leaf and n_iter should be small)\n",
        "\n",
        "In this example, the above information for RGF is wrapped in a python class called *MyRegularizedGreedyForest* that exposes the hyperparameters."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 60,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:50.122632Z",
              "execution_start_time": "2023-04-09T03:13:40.4359303Z",
              "livy_statement_state": "available",
              "parent_msg_id": "4855a514-2527-4852-95e2-743f509bf2c7",
              "queued_time": "2023-04-09T03:10:36.1656825Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 86
            },
            "text/plain": [
              "StatementMeta(automl, 7, 86, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Collecting rgf-python\n",
            "  Using cached rgf_python-3.12.0-py3-none-manylinux1_x86_64.whl (757 kB)\n",
            "Requirement already satisfied: joblib in /home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages (from rgf-python) (1.0.1)\n",
            "Requirement already satisfied: scikit-learn>=0.18 in /home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages (from rgf-python) (0.23.2)\n",
            "Requirement already satisfied: numpy>=1.13.3 in /home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages (from scikit-learn>=0.18->rgf-python) (1.19.4)\n",
            "Requirement already satisfied: threadpoolctl>=2.0.0 in /home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages (from scikit-learn>=0.18->rgf-python) (2.1.0)\n",
            "Requirement already satisfied: scipy>=0.19.1 in /home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages (from scikit-learn>=0.18->rgf-python) (1.5.3)\n",
            "Installing collected packages: rgf-python\n",
            "Successfully installed rgf-python-3.12.0\n"
          ]
        }
      ],
      "source": [
        "%pip install rgf-python   "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 61,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:50.6337005Z",
              "execution_start_time": "2023-04-09T03:13:50.3672163Z",
              "livy_statement_state": "available",
              "parent_msg_id": "6f475eea-c02b-491f-a85e-e696dfdf6882",
              "queued_time": "2023-04-09T03:10:36.2639428Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 87
            },
            "text/plain": [
              "StatementMeta(automl, 7, 87, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "''' SKLearnEstimator is the super class for a sklearn learner '''\n",
        "from flaml.automl.model import SKLearnEstimator\n",
        "from flaml import tune\n",
        "from flaml.automl.data import CLASSIFICATION\n",
        "\n",
        "\n",
        "class MyRegularizedGreedyForest(SKLearnEstimator):\n",
        "    def __init__(self, task='binary', **config):\n",
        "        '''Constructor\n",
        "        \n",
        "        Args:\n",
        "            task: A string of the task type, one of\n",
        "                'binary', 'multiclass', 'regression'\n",
        "            config: A dictionary containing the hyperparameter names\n",
        "                and 'n_jobs' as keys. n_jobs is the number of parallel threads.\n",
        "        '''\n",
        "\n",
        "        super().__init__(task, **config)\n",
        "\n",
        "        '''task=binary or multi for classification task'''\n",
        "        if task in CLASSIFICATION:\n",
        "            from rgf.sklearn import RGFClassifier\n",
        "\n",
        "            self.estimator_class = RGFClassifier\n",
        "        else:\n",
        "            from rgf.sklearn import RGFRegressor\n",
        "            \n",
        "            self.estimator_class = RGFRegressor\n",
        "\n",
        "    @classmethod\n",
        "    def search_space(cls, data_size, task):\n",
        "        '''[required method] search space\n",
        "\n",
        "        Returns:\n",
        "            A dictionary of the search space. \n",
        "            Each key is the name of a hyperparameter, and value is a dict with\n",
        "                its domain (required) and low_cost_init_value, init_value,\n",
        "                cat_hp_cost (if applicable).\n",
        "                e.g.,\n",
        "                {'domain': tune.randint(lower=1, upper=10), 'init_value': 1}.\n",
        "        '''\n",
        "        space = {        \n",
        "            'max_leaf': {'domain': tune.lograndint(lower=4, upper=data_size[0]), 'init_value': 4, 'low_cost_init_value': 4},\n",
        "            'n_iter': {'domain': tune.lograndint(lower=1, upper=data_size[0]), 'init_value': 1, 'low_cost_init_value': 1},\n",
        "            'n_tree_search': {'domain': tune.lograndint(lower=1, upper=32768), 'init_value': 1, 'low_cost_init_value': 1},\n",
        "            'opt_interval': {'domain': tune.lograndint(lower=1, upper=10000), 'init_value': 100},\n",
        "            'learning_rate': {'domain': tune.loguniform(lower=0.01, upper=20.0)},\n",
        "            'min_samples_leaf': {'domain': tune.lograndint(lower=1, upper=20), 'init_value': 20},\n",
        "        }\n",
        "        return space\n",
        "\n",
        "    @classmethod\n",
        "    def size(cls, config):\n",
        "        '''[optional method] memory size of the estimator in bytes\n",
        "        \n",
        "        Args:\n",
        "            config - the dict of the hyperparameter config\n",
        "\n",
        "        Returns:\n",
        "            A float of the memory size required by the estimator to train the\n",
        "            given config\n",
        "        '''\n",
        "        max_leaves = int(round(config['max_leaf']))\n",
        "        n_estimators = int(round(config['n_iter']))\n",
        "        return (max_leaves * 3 + (max_leaves - 1) * 4 + 1.0) * n_estimators * 8\n",
        "\n",
        "    @classmethod\n",
        "    def cost_relative2lgbm(cls):\n",
        "        '''[optional method] relative cost compared to lightgbm\n",
        "        '''\n",
        "        return 1.0\n"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "source": [
        "### Add Customized Learner and Run FLAML AutoML\n",
        "\n",
        "After adding RGF into the list of learners, we run automl by tuning hyperpameters of RGF as well as the default learners. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 62,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        }
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:13:51.1287115Z",
              "execution_start_time": "2023-04-09T03:13:50.8741632Z",
              "livy_statement_state": "available",
              "parent_msg_id": "702a9e5c-a880-483b-985c-4ebbcbde5e07",
              "queued_time": "2023-04-09T03:10:36.3578919Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 88
            },
            "text/plain": [
              "StatementMeta(automl, 7, 88, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "automl = AutoML()\n",
        "automl.add_learner(learner_name='RGF', learner_class=MyRegularizedGreedyForest)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 63,
      "metadata": {
        "slideshow": {
          "slide_type": "slide"
        },
        "tags": []
      },
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:14:03.5802415Z",
              "execution_start_time": "2023-04-09T03:13:51.3699652Z",
              "livy_statement_state": "available",
              "parent_msg_id": "2e5e85aa-8e78-4d78-a275-c6a160a7b415",
              "queued_time": "2023-04-09T03:10:36.4663752Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 89
            },
            "text/plain": [
              "StatementMeta(automl, 7, 89, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[flaml.automl.automl: 04-09 03:13:51] {2726} INFO - task = classification\n",
            "[flaml.automl.automl: 04-09 03:13:51] {2728} INFO - Data split method: stratified\n",
            "[flaml.automl.automl: 04-09 03:13:51] {2731} INFO - Evaluation method: holdout\n",
            "[flaml.automl.automl: 04-09 03:13:51] {2858} INFO - Minimizing error metric: 1-accuracy\n",
            "[flaml.automl.automl: 04-09 03:13:51] {3004} INFO - List of ML learners in AutoML Run: ['RGF', 'lgbm', 'rf', 'xgboost']\n",
            "[flaml.automl.automl: 04-09 03:13:51] {3334} INFO - iteration 0, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3472} INFO - Estimated sufficient time budget=173368s. Estimated necessary time budget=173s.\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3519} INFO -  at 0.9s,\testimator RGF's best error=0.3840,\tbest estimator RGF's best error=0.3840\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3334} INFO - iteration 1, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3519} INFO -  at 1.2s,\testimator RGF's best error=0.3840,\tbest estimator RGF's best error=0.3840\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3334} INFO - iteration 2, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3519} INFO -  at 1.6s,\testimator RGF's best error=0.3840,\tbest estimator RGF's best error=0.3840\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3334} INFO - iteration 3, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3519} INFO -  at 1.6s,\testimator lgbm's best error=0.3777,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:13:52] {3334} INFO - iteration 4, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.0s,\testimator RGF's best error=0.3840,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 5, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.1s,\testimator lgbm's best error=0.3777,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 6, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.1s,\testimator lgbm's best error=0.3777,\tbest estimator lgbm's best error=0.3777\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 7, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.1s,\testimator lgbm's best error=0.3661,\tbest estimator lgbm's best error=0.3661\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 8, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.2s,\testimator lgbm's best error=0.3661,\tbest estimator lgbm's best error=0.3661\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 9, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.2s,\testimator lgbm's best error=0.3633,\tbest estimator lgbm's best error=0.3633\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 10, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.2s,\testimator lgbm's best error=0.3633,\tbest estimator lgbm's best error=0.3633\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 11, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.3s,\testimator lgbm's best error=0.3633,\tbest estimator lgbm's best error=0.3633\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 12, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.3s,\testimator lgbm's best error=0.3613,\tbest estimator lgbm's best error=0.3613\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 13, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.4s,\testimator lgbm's best error=0.3613,\tbest estimator lgbm's best error=0.3613\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 14, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3519} INFO -  at 2.5s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:53] {3334} INFO - iteration 15, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3519} INFO -  at 2.7s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3334} INFO - iteration 16, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3519} INFO -  at 3.1s,\testimator RGF's best error=0.3840,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3334} INFO - iteration 17, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3519} INFO -  at 3.2s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3334} INFO - iteration 18, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3519} INFO -  at 3.4s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3334} INFO - iteration 19, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3519} INFO -  at 3.5s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:54] {3334} INFO - iteration 20, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3519} INFO -  at 4.0s,\testimator RGF's best error=0.3766,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3334} INFO - iteration 21, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3519} INFO -  at 4.1s,\testimator lgbm's best error=0.3591,\tbest estimator lgbm's best error=0.3591\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3334} INFO - iteration 22, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3519} INFO -  at 4.5s,\testimator lgbm's best error=0.3514,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:55] {3334} INFO - iteration 23, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 4.7s,\testimator xgboost's best error=0.3787,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 24, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 4.8s,\testimator xgboost's best error=0.3765,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 25, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 4.8s,\testimator rf's best error=0.3816,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 26, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 4.9s,\testimator rf's best error=0.3724,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 27, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 4.9s,\testimator rf's best error=0.3724,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 28, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 5.0s,\testimator xgboost's best error=0.3765,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 29, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 5.0s,\testimator xgboost's best error=0.3765,\tbest estimator lgbm's best error=0.3514\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 30, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3519} INFO -  at 5.4s,\testimator lgbm's best error=0.3511,\tbest estimator lgbm's best error=0.3511\n",
            "[flaml.automl.automl: 04-09 03:13:56] {3334} INFO - iteration 31, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 5.7s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 32, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 5.9s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 33, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 6.0s,\testimator rf's best error=0.3724,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 34, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 6.3s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 35, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 6.6s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 36, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3519} INFO -  at 6.7s,\testimator xgboost's best error=0.3699,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:57] {3334} INFO - iteration 37, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3519} INFO -  at 6.7s,\testimator rf's best error=0.3724,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3334} INFO - iteration 38, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3519} INFO -  at 6.8s,\testimator xgboost's best error=0.3699,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3334} INFO - iteration 39, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3519} INFO -  at 7.1s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3334} INFO - iteration 40, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3519} INFO -  at 7.3s,\testimator rf's best error=0.3724,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3334} INFO - iteration 41, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3519} INFO -  at 7.4s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:58] {3334} INFO - iteration 42, current learner RGF\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 7.7s,\testimator RGF's best error=0.3766,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 43, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 7.8s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 44, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 7.8s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 45, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 7.9s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 46, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 8.1s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 47, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 8.3s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 48, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 8.4s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 49, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3519} INFO -  at 8.5s,\testimator lgbm's best error=0.3497,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:13:59] {3334} INFO - iteration 50, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:00] {3519} INFO -  at 8.7s,\testimator xgboost's best error=0.3657,\tbest estimator lgbm's best error=0.3497\n",
            "[flaml.automl.automl: 04-09 03:14:00] {3334} INFO - iteration 51, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:01] {3519} INFO -  at 10.5s,\testimator lgbm's best error=0.3448,\tbest estimator lgbm's best error=0.3448\n",
            "[flaml.automl.automl: 04-09 03:14:03] {3783} INFO - retrain lgbm for 1.6s\n",
            "[flaml.automl.automl: 04-09 03:14:03] {3790} INFO - retrained model: LGBMClassifier(colsample_bytree=0.6649148062238498,\n",
            "               learning_rate=0.06500463168967066, max_bin=255,\n",
            "               min_child_samples=5, n_estimators=190, num_leaves=20,\n",
            "               reg_alpha=0.0017271108100233477, reg_lambda=0.00468154746700776,\n",
            "               verbose=-1)\n",
            "[flaml.automl.automl: 04-09 03:14:03] {3034} INFO - fit succeeded\n",
            "[flaml.automl.automl: 04-09 03:14:03] {3035} INFO - Time taken to find the best model: 10.480074405670166\n"
          ]
        }
      ],
      "source": [
        "settings = {\n",
        "    \"time_budget\": 10,  # total running time in seconds\n",
        "    \"metric\": 'accuracy', \n",
        "    \"estimator_list\": ['RGF', 'lgbm', 'rf', 'xgboost'],  # list of ML learners\n",
        "    \"task\": 'classification',  # task type    \n",
        "    \"log_file_name\": 'airlines_experiment_custom_learner.log',  # flaml log file \n",
        "    \"log_training_metric\": True,  # whether to log training metric\n",
        "}\n",
        "\n",
        "automl.fit(X_train=X_train, y_train=y_train, **settings)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## 5. Customized Metric\n",
        "\n",
        "It's also easy to customize the optimization metric. As an example, we demonstrate with a custom metric function which combines training loss and validation loss as the final loss to minimize."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 64,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:14:04.1303148Z",
              "execution_start_time": "2023-04-09T03:14:03.8308127Z",
              "livy_statement_state": "available",
              "parent_msg_id": "e1ced49a-d49a-4496-8ded-58deb936d247",
              "queued_time": "2023-04-09T03:10:36.6448318Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 90
            },
            "text/plain": [
              "StatementMeta(automl, 7, 90, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "def custom_metric(X_val, y_val, estimator, labels, X_train, y_train,\n",
        "                  weight_val=None, weight_train=None, config=None,\n",
        "                  groups_val=None, groups_train=None):\n",
        "    from sklearn.metrics import log_loss\n",
        "    import time\n",
        "    start = time.time()\n",
        "    y_pred = estimator.predict_proba(X_val)\n",
        "    pred_time = (time.time() - start) / len(X_val)\n",
        "    val_loss = log_loss(y_val, y_pred, labels=labels,\n",
        "                         sample_weight=weight_val)\n",
        "    y_pred = estimator.predict_proba(X_train)\n",
        "    train_loss = log_loss(y_train, y_pred, labels=labels,\n",
        "                          sample_weight=weight_train)\n",
        "    alpha = 0.5\n",
        "    return val_loss * (1 + alpha) - alpha * train_loss, {\n",
        "        \"val_loss\": val_loss, \"train_loss\": train_loss, \"pred_time\": pred_time\n",
        "    }\n",
        "    # two elements are returned:\n",
        "    # the first element is the metric to minimize as a float number,\n",
        "    # the second element is a dictionary of the metrics to log"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "We can then pass this custom metric function to automl's `fit` method."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 65,
      "metadata": {},
      "outputs": [
        {
          "data": {
            "application/vnd.livy.statement-meta+json": {
              "execution_finish_time": "2023-04-09T03:14:16.3791532Z",
              "execution_start_time": "2023-04-09T03:14:04.3643576Z",
              "livy_statement_state": "available",
              "parent_msg_id": "e472943a-3204-41fc-a723-5f39f302b04c",
              "queued_time": "2023-04-09T03:10:36.8448553Z",
              "session_id": "7",
              "session_start_time": null,
              "spark_jobs": null,
              "spark_pool": "automl",
              "state": "finished",
              "statement_id": 91
            },
            "text/plain": [
              "StatementMeta(automl, 7, 91, Finished, Available)"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "[flaml.automl.automl: 04-09 03:14:04] {2726} INFO - task = classification\n",
            "[flaml.automl.automl: 04-09 03:14:04] {2728} INFO - Data split method: stratified\n",
            "[flaml.automl.automl: 04-09 03:14:04] {2731} INFO - Evaluation method: holdout\n",
            "[flaml.automl.automl: 04-09 03:14:04] {2858} INFO - Minimizing error metric: customized metric\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3004} INFO - List of ML learners in AutoML Run: ['lgbm', 'rf', 'xgboost', 'extra_tree', 'xgb_limitdepth', 'lrl1']\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3334} INFO - iteration 0, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3472} INFO - Estimated sufficient time budget=11191s. Estimated necessary time budget=258s.\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3519} INFO -  at 0.4s,\testimator lgbm's best error=0.6647,\tbest estimator lgbm's best error=0.6647\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3334} INFO - iteration 1, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3519} INFO -  at 0.5s,\testimator lgbm's best error=0.6647,\tbest estimator lgbm's best error=0.6647\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3334} INFO - iteration 2, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3519} INFO -  at 0.5s,\testimator lgbm's best error=0.6491,\tbest estimator lgbm's best error=0.6491\n",
            "[flaml.automl.automl: 04-09 03:14:04] {3334} INFO - iteration 3, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.7s,\testimator xgboost's best error=0.6845,\tbest estimator lgbm's best error=0.6491\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 4, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.8s,\testimator extra_tree's best error=0.6678,\tbest estimator lgbm's best error=0.6491\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 5, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.8s,\testimator lgbm's best error=0.6423,\tbest estimator lgbm's best error=0.6423\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 6, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.9s,\testimator lgbm's best error=0.6423,\tbest estimator lgbm's best error=0.6423\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 7, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.9s,\testimator lgbm's best error=0.6423,\tbest estimator lgbm's best error=0.6423\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 8, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 0.9s,\testimator lgbm's best error=0.6400,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 9, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.0s,\testimator lgbm's best error=0.6400,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 10, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.2s,\testimator xgboost's best error=0.6845,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 11, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.3s,\testimator extra_tree's best error=0.6576,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 12, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.3s,\testimator rf's best error=0.6614,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 13, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.4s,\testimator rf's best error=0.6523,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 14, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.4s,\testimator rf's best error=0.6523,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 15, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.5s,\testimator xgboost's best error=0.6503,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 16, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3519} INFO -  at 1.6s,\testimator lgbm's best error=0.6400,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:05] {3334} INFO - iteration 17, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 1.8s,\testimator extra_tree's best error=0.6576,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 18, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 1.8s,\testimator lgbm's best error=0.6400,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 19, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.0s,\testimator xgboost's best error=0.6486,\tbest estimator lgbm's best error=0.6400\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 20, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.1s,\testimator lgbm's best error=0.6335,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 21, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.1s,\testimator lgbm's best error=0.6335,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 22, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.2s,\testimator lgbm's best error=0.6335,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 23, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.3s,\testimator lgbm's best error=0.6335,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 24, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.4s,\testimator rf's best error=0.6523,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 25, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.5s,\testimator extra_tree's best error=0.6576,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 26, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3519} INFO -  at 2.6s,\testimator lgbm's best error=0.6335,\tbest estimator lgbm's best error=0.6335\n",
            "[flaml.automl.automl: 04-09 03:14:06] {3334} INFO - iteration 27, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3519} INFO -  at 2.9s,\testimator lgbm's best error=0.6328,\tbest estimator lgbm's best error=0.6328\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3334} INFO - iteration 28, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3519} INFO -  at 3.0s,\testimator extra_tree's best error=0.6576,\tbest estimator lgbm's best error=0.6328\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3334} INFO - iteration 29, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3519} INFO -  at 3.1s,\testimator extra_tree's best error=0.6443,\tbest estimator lgbm's best error=0.6328\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3334} INFO - iteration 30, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3519} INFO -  at 3.4s,\testimator lgbm's best error=0.6241,\tbest estimator lgbm's best error=0.6241\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3334} INFO - iteration 31, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3519} INFO -  at 3.7s,\testimator lgbm's best error=0.6241,\tbest estimator lgbm's best error=0.6241\n",
            "[flaml.automl.automl: 04-09 03:14:07] {3334} INFO - iteration 32, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3519} INFO -  at 4.0s,\testimator lgbm's best error=0.6206,\tbest estimator lgbm's best error=0.6206\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3334} INFO - iteration 33, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3519} INFO -  at 4.1s,\testimator extra_tree's best error=0.6443,\tbest estimator lgbm's best error=0.6206\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3334} INFO - iteration 34, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3519} INFO -  at 4.4s,\testimator lgbm's best error=0.6206,\tbest estimator lgbm's best error=0.6206\n",
            "[flaml.automl.automl: 04-09 03:14:08] {3334} INFO - iteration 35, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3519} INFO -  at 4.7s,\testimator lgbm's best error=0.6206,\tbest estimator lgbm's best error=0.6206\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3334} INFO - iteration 36, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3519} INFO -  at 4.8s,\testimator extra_tree's best error=0.6416,\tbest estimator lgbm's best error=0.6206\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3334} INFO - iteration 37, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3519} INFO -  at 5.3s,\testimator lgbm's best error=0.6185,\tbest estimator lgbm's best error=0.6185\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3334} INFO - iteration 38, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3519} INFO -  at 5.4s,\testimator rf's best error=0.6458,\tbest estimator lgbm's best error=0.6185\n",
            "[flaml.automl.automl: 04-09 03:14:09] {3334} INFO - iteration 39, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3519} INFO -  at 6.0s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3334} INFO - iteration 40, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3519} INFO -  at 6.4s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3334} INFO - iteration 41, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3519} INFO -  at 6.6s,\testimator rf's best error=0.6458,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:10] {3334} INFO - iteration 42, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3519} INFO -  at 7.1s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3334} INFO - iteration 43, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3519} INFO -  at 7.3s,\testimator rf's best error=0.6425,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3334} INFO - iteration 44, current learner extra_tree\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3519} INFO -  at 7.4s,\testimator extra_tree's best error=0.6416,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3334} INFO - iteration 45, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3519} INFO -  at 7.6s,\testimator rf's best error=0.6384,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:11] {3334} INFO - iteration 46, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:12] {3519} INFO -  at 8.1s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:12] {3334} INFO - iteration 47, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:12] {3519} INFO -  at 8.3s,\testimator rf's best error=0.6384,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:12] {3334} INFO - iteration 48, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.0s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 49, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.1s,\testimator xgb_limitdepth's best error=0.6682,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 50, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.2s,\testimator xgb_limitdepth's best error=0.6682,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 51, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.3s,\testimator xgb_limitdepth's best error=0.6542,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 52, current learner xgboost\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.3s,\testimator xgboost's best error=0.6486,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 53, current learner rf\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3519} INFO -  at 9.4s,\testimator rf's best error=0.6384,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:13] {3334} INFO - iteration 54, current learner lgbm\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3519} INFO -  at 9.8s,\testimator lgbm's best error=0.6156,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3334} INFO - iteration 55, current learner xgb_limitdepth\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3519} INFO -  at 10.0s,\testimator xgb_limitdepth's best error=0.6496,\tbest estimator lgbm's best error=0.6156\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3783} INFO - retrain lgbm for 0.3s\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3790} INFO - retrained model: LGBMClassifier(colsample_bytree=0.9031374907114736,\n",
            "               learning_rate=0.3525398690474661, max_bin=1023,\n",
            "               min_child_samples=4, n_estimators=22, num_leaves=69,\n",
            "               reg_alpha=0.0060777294606297145, reg_lambda=37.65858370595088,\n",
            "               verbose=-1)\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3034} INFO - fit succeeded\n",
            "[flaml.automl.automl: 04-09 03:14:14] {3035} INFO - Time taken to find the best model: 5.982900142669678\n"
          ]
        }
      ],
      "source": [
        "automl = AutoML()\n",
        "settings = {\n",
        "    \"time_budget\": 10,  # total running time in seconds\n",
        "    \"metric\": custom_metric,  # pass the custom metric funtion here\n",
        "    \"task\": 'classification',  # task type\n",
        "    \"log_file_name\": 'airlines_experiment_custom_metric.log',  # flaml log file\n",
        "}\n",
        "\n",
        "automl.fit(X_train=X_train, y_train=y_train, **settings)"
      ]
    }
  ],
  "metadata": {
    "description": null,
    "kernelspec": {
      "display_name": "Synapse PySpark",
      "name": "synapse_pyspark"
    },
    "language_info": {
      "name": "python"
    },
    "save_output": true,
    "synapse_widget": {
      "state": {},
      "version": "0.1"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}
